package LeetCode刷题;

/**
 * @program: Java_Study
 * @author: Xiaofan
 * @createTime: 2022-03-17 10:21
 * @description: Functions of this class is
 *官方题解：！！！！！！！！！！！！！判断是否死循环先想到快慢指针！！！！！！！！！！！！！！！
 * class Solution {
 *
 *      public int getNext(int n) {
 *         int totalSum = 0;
 *         while (n > 0) {
 *             int d = n % 10;
 *             n = n / 10;
 *             totalSum += d * d;
 *         }
 *         return totalSum;
 *     }
 *
 *     public boolean isHappy(int n) {
 *         int slowRunner = n;
 *         int fastRunner = getNext(n);
 *         while (fastRunner != 1 && slowRunner != fastRunner) {
 *             slowRunner = getNext(slowRunner);
 *             fastRunner = getNext(getNext(fastRunner));
 *         }
 *         return fastRunner == 1;
 *     }
 * }
 **/
public class No快乐数 {

}